@ECHO OFF
@COLOR 02
@TITLE VueScan Pro [ BlockNet ]
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO Do you want to start? [ y / n ]
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@SET /P QUEST=
@IF NOT "%QUEST%"=="y" EXIT
@CLS

@SET REG_HOSTS_KEY=HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters
@SET REG_HOSTS_PARAM=DataBasePath
@SET HOSTS_PATH=%WINDIR%\System32\drivers\etc
@SET HOSTS_URL=stats.hamrick.com static.hamrick.com www.hamrick.com

@FOR /F "tokens=3" %%a IN ('REG QUERY "%REG_HOSTS_KEY%" /v %REG_HOSTS_PARAM%') DO IF "%%a"=="%REG_HOSTS_PARAM%" SET HOSTS_PATH=%%c
@ECHO check rights...>> "%HOSTS_PATH%\hosts_tmp"
@IF EXIST "%HOSTS_PATH%\hosts_tmp" (IF EXIST "%HOSTS_PATH%\hosts_tmp" DEL "%HOSTS_PATH%\hosts_tmp" /F /Q
@IF EXIST "%HOSTS_PATH%\hosts" ATTRIB -R "%HOSTS_PATH%\hosts"
@CMD /c TYPE "%HOSTS_PATH%\hosts" | FINDSTR /I /V "%HOSTS_URL%"> "%HOSTS_PATH%\hosts_tmp"
@ECHO 0.0.0.0       %HOSTS_URL%>> "%HOSTS_PATH%\hosts_tmp"
@IF EXIST "%HOSTS_PATH%\hosts" DEL "%HOSTS_PATH%\hosts" /F /Q
@REN "%HOSTS_PATH%\hosts_tmp" "hosts") ELSE (GOTO ERROR)

@CLS
@ECHO ~~~~~~~~~~~~~~~~~~~~
@ECHO All done. {www.AsanDl.com} Closing...
@ECHO ~~~~~~~~~~~~~~~~~~~~
@PING -n 3 127.0.0.1 > nul
@EXIT

:ERROR
@CLS
@COLOR 04
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO ACCESS ERROR:  {www.AsanDl.com Run with administrator rights!
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@PAUSE